package com.leyou.auth.web;

import com.leyou.auth.service.ClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("client")
public class ClientAuthController {

    @Autowired
    private ClientService clientService;

    @GetMapping("key")
    public ResponseEntity<String> getKey(@RequestParam("clientId")String clientId,@RequestParam("secret") String secret) {
        //调用方法
        String key = clientService.getKey(clientId, secret);
        //返回
        return ResponseEntity.ok(key);
    }
}
